update internals 7

Documentation Version for Comments and Changes

You are invited to make any changes...add any comments.

Changes will `eventually` be merged into the offical documentation.

Leave any commnents here...

...

... back to index page OE documentation



The minimal Euphoria integer. This is -(230).

MAXINT

<internal> signed int MAXINT 

The maximal Euphoria integer. This is 230-1.

HIGH_BITS

<internal> signed int HIGH_BITS 

HIGH_BITS is an integer value such that if another integer value c lies outside of the range between MININT and MAXINT, c+HIGH_BITS will be non-negative.

Proof that HIGH_BITS is #C000_0000 on 32-bit version of EUPHORIA.
  • In the following expressions powers have higher precedence than unuary minus.* if c is a non-ATOM-INT value, then

c belongs to the set [-231,-230-1(=NOVALUE)] U [230,231].

c+-230 belongs to the set [-231-230,-230-1-230] U [230-230,230] which is [-3*230,-231-1] U [0,230]. However the lower values wrap around to non-negative numbers:

-231-1 wraps to 231-1. -3*230 wraps around to 230.

c+-230 belongs to the set [230,231-1] U [0,230] = [0,231-1]

This is the set of all non-negative numbers that can fit into 32-bit signed longs. -230 is the unsigned version of #C000_0000. QED.

A visual way of looking at it is, adding #C000_0000 to the set of non-ATOM_INTS rotates the set to the negative side by -MININT (2^30). The already negative ones wrap around to the positive; the positive numbers stay positive and hug the zero. Since adding #C000_0000 on registers is 1-1 and onto, we also know that ATOM_INTs will all be mapped to negative signed longs.

Testing for Overflow:

There are two ways to test for overflow:

  1. (c > MAXINT) || (c < MININT)
  2. (c + HIGH_BITS) >= 0

Parser

Inserting tokens into the token buffer is the easiest way to add features to the EUPHORIA parser. The tokens are two-element sequences one of the class of token and the other the token's value:

{<class>,<value>}

Each of the class values are capitalized words for some keyword or VARIABLE. The list of constants is in reswords.e. Often it is enough to only examin the class. In the case of variables, it is important to know which variable. In this case the second element, comes into play.

You can use putback to put tokens into the token buffer. The tokens will be pulled out by the parser in a filo manner, like a stack.

Backend Instructions

After the Parser processes the instructions. It creates Backend instructions that are easily translated or interpreted. The system uses opcodes and some parameters which are put on a stack. This backend language is similar to assembler. You have opcodes (instructions) and parameters. These parameters must be integers themselves but some may serve as pointers to arbitrary EUPHORIA objects. As a developer of EUPHORIA itself,

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu